<template>
    <div>
        <blogshow :mothed="mothed"></blogshow>
    </div>
</template>

<script>
import blogshow from './blogshow'
export default {
    data () {
      return {
          user:"",
          mothed:"",//准备传给子模板
      }
    },

    methods: {
        getUser(){
            // console.log(localStorage.getItem("user"))
            this.user=JSON.parse(localStorage.getItem("user")) ,
            this.mothed=this.user.loginId;
        },
    },
    // created(){
    //     this.getUser()
    // },
    mounted(){
        this.getUser()
    },
        // 检测mothed变化
    watch: {
            //正确给 mothed 赋值的 方法
        mothed: function(newVal,oldVal){
            // console.log(newVal,oldVal)
            this.mothed = newVal;  //newVal即是chartData
        },
    },
    components: {
        blogshow
    },
}
</script>

<style scoped>
</style>